package com.kungfu.utils;

import com.kungfu.config.Constant;
import org.springframework.stereotype.Component;

import java.util.Calendar;

@Component
public class ZzdhUtils {
    public String createZzdh() {
        Calendar calendar = Calendar.getInstance();
        String zzdNo = Constant.HospitalType.HK + calendar.get(Calendar.YEAR) + (calendar.get(Calendar.MONTH) + 1) + calendar.get(Calendar.DAY_OF_MONTH) + calendar.get(Calendar.HOUR) + calendar.get(Calendar.MINUTE) + calendar.get(Calendar.SECOND) + Constant.HospitalType.XH + random();
        return zzdNo;
    }

    public String random() {
        String num = "";
        for (int i = 0; i < 4; i++) {
            num += (int) Math.floor(Math.random() * 10);
        }
        return num;
    }

    public static void main(String[] args) {
        ZzdhUtils zzdhUtils = new ZzdhUtils();
        System.out.println(zzdhUtils.createZzdh());
    }
}
